﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace BootstrapAdmin.DataAccess.Models;

/// <summary>
/// 卡号权限等级
/// </summary>
public enum CardInfoLevel
{
    [Display(Name = "1")]
    P1 = 1,

    [Display(Name = "2")]
    P2 = 2,

    [Display(Name = "3")]
    P3 = 3,

    [Display(Name = "4")]
    P4 = 4,

    [Display(Name = "5")]
    P5 = 5,
}

/// <summary>
/// 卡号信息
/// </summary>
[Table("ops_card_info")]
public class CardInfo
{
    [Key]
    public int Id { get; set; }

    /// <summary>
    /// 卡号
    /// </summary>
    [NotNull]
    [Required]
    [Display(Name = "卡号")]
    public string? CardNo { get; set; }

    /// <summary>
    /// 权限等级
    /// </summary>
    [NotNull]
    [Required]
    [Display(Name = "权限等级")]
    public CardInfoLevel? PLevel { get; set; }
    
    /// <summary>
    /// 持卡人信息
    /// </summary>
    [Display(Name = "持卡人")]
    public string? Owner { get; set; }

    /// <summary>
    /// 描述信息
    /// </summary>
    [Display(Name = "描述")]
    public string? Description { get; set; }

    /// <summary>
    /// 是否已禁用
    /// </summary>
    [Display(Name = "是否启用")]
    public bool IsEnabled { get; set; } = true;

    [Display(Name = "创建者")]
    public string? CreatedBy { get; set; }

    [Display(Name = "创建时间")]
    public DateTime? CreatedAt { get; set; }

    [Display(Name = "更新者")]
    public string? UpdatedBy { get; set; }

    [Display(Name = "更新时间")]
    public DateTime? UpdatedAt { get; set; }
}
